Skip to content

Phase 3b: Integrate Tauri viewer into CLI and add legacy-browser fallback - #36

Merged
zackees merged 1 commit into
mainfrom
rust/phase-3b-integrate-tauri
Apr 12, 2026
Merged

zackees merged 1 commit into
mainfrom
rust/phase-3b-integrate-tauri

Conversation

@zackees

@zackees zackees commented Apr 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds crates/fastled-cli/src/viewer.rs with find_tauri_viewer() (checks sibling exe dir, target/debug/, target/release/, PATH) and launch_tauri_viewer() that spawns the fastled-viewer binary.
  • Updates main.rs: when --app is passed and the Tauri viewer is found, Python is invoked with --just-compile only, then the Rust process launches and waits for the native viewer. If the viewer launch fails, falls back automatically to the legacy Flask+Playwright path.
  • Adds --legacy-browser CLI flag to force the old Flask+browser behaviour even when the native viewer is available.
  • Exposes viewer_available() -> bool in the PyO3 bridge (fastled-py/_native) so Python callers can introspect viewer presence.
  • No Python files were modified; Flask, Playwright, cryptography and all existing dependencies are untouched (Phase 4 concern).

Closes #24

Test plan

  • ./_cargo build --workspace — compiles cleanly
  • ./_cargo test --workspace — 47 Rust tests pass (3 new viewer tests)
  • ./_cargo clippy --workspace --all-targets -- -D warnings — clean
  • ./_cargo fmt --all --check — clean
  • bash lint — ruff/black/isort/pyright all pass
  • bash test — all 121 Python tests pass
  • Manual: fastled <sketch> --app with viewer binary present launches native viewer
  • Manual: fastled <sketch> --app --legacy-browser skips viewer and opens Flask+browser
  • Manual: fastled <sketch> --app without viewer binary falls back to Flask+browser silently

When --app is passed and the fastled-viewer binary is found (sibling of
the running exe, cargo target/{debug,release}/, or PATH), the Rust CLI
now drives the build-then-view flow directly:
  1. Python is invoked with --just-compile (no browser).
  2. fastled-viewer is spawned pointing at <sketch>/fastled_js.
  3. If the viewer cannot be launched, automatically falls back to the
     full Python Flask+Playwright path.

Add --legacy-browser flag to force the old Flask+browser behaviour even
when the native viewer is available.

Expose viewer_available() in the PyO3 bridge (fastled-py/_native) so
Python callers can query viewer presence.

No Python files were modified; Flask, Playwright, and all existing
dependencies are untouched.
@zackees
zackees merged commit fa42dd0 into main Apr 12, 2026
0 of 9 checks passed
@zackees
zackees deleted the rust/phase-3b-integrate-tauri branch November 5, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 3b: Integrate Tauri viewer into CLI and remove Flask

1 participant